import 'dart:async';

import 'package:flutter/material.dart';

void main(){
  runApp(const MyApp());
}

TextEditingController _input_title = TextEditingController();
TextEditingController _input_body = TextEditingController();

class InputTitle extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return TextField(
      autofocus: true,
      controller: _input_title,
      decoration: InputDecoration(
        labelText: '待办标题',
        hintText: '别空着，请输入标题',
        prefixIcon: Icon(Icons.book),
      ),
    );
  }
}

class InputBody extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return TextField(
      autofocus: true,
      controller: _input_body,
      minLines: 1,
      maxLines: 20,
      decoration: InputDecoration(
          labelText: '待办描述',
          hintText: '描述一下这个待办',
          prefixIcon: Icon(Icons.add_box)
      ),
    );
  }
}

class PushButton extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return TextButton(
      child: Text('确定'),
      onPressed: () {
        //DynamicData.TitleAdd(_input_title.text);
        //DynamicData.BodyAdd(_input_body.text);
        Navigator.pop(context);
      },
    );
  }
}

class MyHomePage extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('编辑Todo'),
      ),
    );
  }
}

class MyApp extends StatelessWidget{
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: '编辑Todo',
      home: MyHomePage(),
    );
  }
}